import allure
from selenium.webdriver.common.by import By

from pages.addmemberpage import AddMember
from pages.basepage import Base
from pages.contactpage import ContactPage


class IndexPage(Base):
    # 添加成员按钮
    _add_member = (By.CSS_SELECTOR, ".index_service_cnt_item_title")

    @allure.step("点击'添加成员'")
    def goto_add_member(self):
        """
        点击添加成员按钮，跳转到添加成员页面
        :return: AddMember实例
        """

        self.find_wait(self._add_member).click()
        return AddMember(self.driver)

    def goto_impot_contact(self):
        pass

    @allure.step("点击通讯录")
    def goto_contact_page(self):
        """
        点击联系人页签，跳转到联系人页面
        :return: ContactPage实例
        """
        self.driver.find_element(By.ID, "menu_contacts").click()
        return ContactPage(self.driver)
